A script becomes a plain C++ function, generated whether or not the project currently calls it anywhere - unlike an asset, its code is never pruned for being unused.
What GBML is already covers the general shape: every .gbml file is compiled ahead of time into C++, with a #line directive pointing each generated line back at the exact source line that produced it, so a mistake still shows up in your file, never in generated code you never open. A script follows that same rule and nothing more - it becomes one ordinary, top-level C++ function, in its own generated file, sitting beside the engine's own hand-written code at the same speed:
// scripts/double_it.gbml compiles to roughly this, in its own generated file
// (src/game_scripts_double_it.cpp):
int game::double_it(gbml::instance& self, int amount)
{
return amount * 2;
}The extra first parameter, self, is how a script runs as the object that called it: every call hands over the object whose code made the call, and self, x, draw_text(...) and the rest inside the script work on it. You never write it and never pass it - Writing a script covers what it means.
There is no wrapper object, no lookup table, and no runtime cost to a script existing beyond the machine code its own body actually needs - calling one is an ordinary C++ function call.
Writing a script already shows the message a script with no matching function produces the moment something tries to call it. That check is deliberately placed at the call, not at the moment the file itself is saved, because a script file with no matching function is not wrong by itself: it might legitimately hold nothing but a shared declaration, or nothing at all. The first thing that is actually, provably broken is a real call with nothing behind it to run - so that is the one place this gets flagged, with the exact file and the exact fix named.
The alternative would be worse for exactly the person this is trying to help: left unreported, a call to a misnamed script would still compile - it would simply generate no C++ for the script at all, and the call itself would fail far away from the mistake, as a devkitARM linker error naming a function that was never written. Catching it here, in GBML's own checker, turns that into a message that names the file and the exact fix instead.
Gbabel generates a real C++ function for every script whose file has a matching top-level function, whether or not anything in the project actually calls it anywhere - the same way every declared object gets its own generated code regardless of whether a room places it. Deleting every call to a script, but leaving its file behind, does not remove it from the next build; only deleting the file (or its matching function) does.
This is different from an asset - a sprite, a sound, a whole tileset. What goes into the ROM covers how those are staged into a build only when something actually reaches them, and dropped, with a reason, when nothing does. A script's own code is never pruned that way. What a script's own body happens to reference - a sound it plays, a sprite it creates - is still subject to that project's usual reachability story; if you need to know exactly what a particular build actually included, that page's own build report is the accurate source, not a general rule stated here.
If a script file has no top-level function matching its own name, and nothing in the project ever calls it, the build does not fail - it simply generates no C++ for that file and only makes a short note of it. Only an actual call to that name turns this into the hard error that Writing a script covers; an unnamed or empty script sitting unused in the project costs nothing and breaks nothing.